package com.lzy.pattern.factory.before;

/**
 * @ClassName: CoffeeStore
 * @Description: TODO
 * @Author: LiuZy
 * @Date: 2022/4/11 20:16
 * @Version: 1.0
 */
public class CoffeeStore {
    public Coffee order(String type){
        Coffee coffee = null;
        if("american".equals(type)){
            coffee = new AmericanCoffee();
        }else if("latte".equals(type)){
            coffee = new LatteCoffee();
        }else {
            throw new RuntimeException("你要点的咖啡木得啊。");
        }
        coffee.addMilk();
        coffee.addSugar();

        return coffee;
    }
}